<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
	
    protected function _initDb()
    {
    	$optionResources = $this->getOption('resources');
    	$dbOption = $optionResources['db'];
    	$dbOption['params']['username'] = 'root';
    	$dbOption['params']['password'] = 'root';
    	$dbOption['params']['dbname'] = 'zend';
    	$adapter = $dbOption['adapter'];
    	$config = $dbOption['params'];
    	$db = Zend_Db::factory($adapter,$config);
    	$db->setFetchMode(Zend_Db::FETCH_ASSOC);
    	$db->query("SET NAMES 'utf8'");
    	$db->query("SET CHARACTER SET 'utf8'");
    	
    	Zend_Registry::set('connectDb',$db);
    	
    	Zend_Db_Table::setDefaultAdapter($db);
    
    	return $db;
       
    }
   	public function _initAutoload(){
        $front = Zend_Controller_Front::getInstance();
        $front->registerPlugin(new Zend_Controller_Plugin_ErrorHandler(array(
                                'module'     => 'error',
                                'controller' => 'error',
                                'action'     => 'error'
        )));
        
    }
    
 /*   protected function _initView()
    {
    	$view = new Zendvn_View_Smarty($this->getOption('smarty'));
    	$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
    	$viewRenderer->setViewSuffix('tpl');
    	$viewRenderer->setViewScriptPathSpec(":controller/:action.:suffix");
    	$viewRenderer->setView($view);
    	$this->bootstrap('layout');
    	$layout = Zend_Layout::getMvcInstance();
    	$layout->setLayoutPath(TEMPLATE_PATH.'/smarty')
    	->setLayout('layout')
    	->setViewSuffix('tpl');
    	return $view;
    }
 */
}
